/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package InternetHax;

/**
 *
 * @author LoginError
 *///a simple wrapper class for a point in 2d space
public class Point2d {

    int x, y;

    public Point2d() {

    }

    public Point2d(Point2d otherPoint) {
        this.x = otherPoint.x;
        this.y = otherPoint.y;
    }

    public Point2d(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public void add(int x, int y)
    {
        this.x += x;
        this.y += y;
    }

    public void add(Point2d otherPoint) {
        this.x += otherPoint.x;
        this.y += otherPoint.y;
    }

    public void setReallyFarAway() {
        this.x = Integer.MIN_VALUE;
        this.y = Integer.MIN_VALUE;
    }

    public double distanceTo(Point2d anotherpoint) {
        return distanceTo(anotherpoint.x, anotherpoint.y);
    }

    public double distanceTo(int anotherx, int anothery) {
        int a = this.x - anotherx;
        int b = this.y - anothery;

        return Math.sqrt(a * a + b * b);
    }

    public static double manhattenDistance(int x1, int y1, int x2, int y2) {
        return (Math.abs(x1 - x2) + Math.abs(y1 - y2));

    }
    
    public String toString()
    {
        return "("+this.x+", "+this.y+")";
    }

    public static double distanceBetween(int x1, int y1, int x2, int y2) {
        int a = x1 - x2;
        int b = y1 - y2;

        return Math.sqrt(a * a + b * b);
    }
}
